import request from '@/utils/request'
import sha1 from 'sha1'
// import axios from 'axios'
// const BASE_URL = process.env.VUE_APP_BASE_API

export function login(data) {
  // sha1加密
  const sha1Pwd = sha1(data.password)
  console.log(sha1Pwd)
  return request({
    url: `/student/login?userUuid=${data.userUuid}&password=${sha1Pwd}`,
    method: 'get'
    // data
  })
}

export function updatePassword(newpwd) {
  return request({
    url: `/student/updatePassword`,
    method: 'post',
    params: {
      password: sha1(newpwd)
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/student/getUserInfo',
    method: 'get'
  })
}

export function logout() {
  // return request({
  //   url: '/student/logout',
  //   method: 'get'
  // })
  return new Promise((resolve, reject) => {
    resolve({
      code: 200,
      msg: 'success'
    })
  })
}
